﻿using System.Collections.Generic;
using MvcApplication1.Utility;
using RIMS.Lib.Models;

namespace MvcApplication1.Actions.EmployeeActions
{
    public class Common : Action
    {
        protected const string EMPLOYEE_LIST = "employeeList";
        protected const string YEAR = "year";

        public FlexiGridRow GetFlexiGrid(Employee employee)
        {
            FlexiGridRow row = new FlexiGridRow
            {
                id = employee.OID.ToString(),
                cell = {Tools.NEW, employee.OID.ToString(), employee.Name, employee.MobileNo, employee.email }
            };

            return row;
        }

        public FlexiGridObject GetFlexiGridList(int page, int count, IList<Employee> employees)
        {
            int counter = START + 1;
            FlexiGridObject flexiGridObject = new FlexiGridObject { page = page, total = count };
            foreach (Employee item in employees)
            {
                FlexiGridRow row = new FlexiGridRow
                {
                    id = item.OID.ToString(),
                    cell = {counter.ToString(), item.OID.ToString(), item.Name, item.MobileNo, item.email }
                };
                flexiGridObject.rows.Add(row);
                counter++;
            }

            return flexiGridObject;
        }
    }
}